<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/manage/common/taglibs.jsp"%>

<script language="JavaScript">
function manage_role_onSuccessLoad(){
	var row = $('#manage_role_datagrid').datagrid('getSelected');
	resources = $(row).attr('rescs')
	if(resources){
		$(resources).each(function(){
			$('#manage_role_resource_datagrid').datagrid('selectRecord',this['id']);
		});
	}
}
</script>


<div>
    <form id="manage_role_editform" action="${pageContext.request.contextPath}/manage/system/role/${action=='create'?'saveJson':'updateJson'}.html" method="post">
      <jodd:form bean="role" scope="request">
        <input name="id" type="hidden" />
        <table class="tableForm" width="98%" align="center">
          <tr>
            <th style="width: 80px">角色名称：</th>
            <td><input name="name" type="text" class="easyui-validatebox" data-options="required:true" /></td>
          </tr>
          <tr>
            <th>备注</th>
            <td><textarea name="descn" rows="3" cols="40" class="easyui-validatebox"></textarea></td>
          </tr>
        </table>
        
         <table id="manage_role_resource_datagrid" class="easyui-datagrid" url="${pageContext.request.contextPath}/manage/system/resource/listAllJson.html" 
          title="选择角色权限和资源"
          fit="false" border="false" fitColumns="true" idField="id" checkOnSelect="true" selectOnCheck="true"
          data-options="onLoadSuccess:manage_role_onSuccessLoad,view:groupview, groupField:'menu', groupFormatter:function(value,rows){ return $(value).attr('name') + ' - ' + rows.length;}">
            <thead>
              <tr>
                <th field="resourceId" checkbox="true" data-options="formatter:function(value, row, index){ return row.id }">编号</th>
                <th field="id" width="20">编号</th>
                <th field="name" width="50">名称</th>
                <th field="resType" width="50">类型</th>
                <th field="resString" width="100">资源</th>
              </tr>
            </thead>
          </table>
      </jodd:form>
    </form>
</div>


